package pattern.rmiproxy;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class GumballMonitorTestDrive
{
	public static void main(String[] args)
	{
		String [] location = {"rmi://www.aaa.com/test"};
		GumballMonitor[] monitor = new GumballMonitor[location.length];
		for (int i = 0; i < monitor.length; i++)
		{
			try
			{
				GumballMachineRemote machineRemote = (GumballMachineRemote) Naming.lookup(location[i]);
				monitor[i] =new GumballMonitor(machineRemote);
			}
			catch (MalformedURLException e)
			{
				e.printStackTrace();
			}
			catch (RemoteException e)
			{
				e.printStackTrace();
			}
			catch (NotBoundException e)
			{
				e.printStackTrace();
			}
			
		}
	}
}
